#pragma once


	template<class iterator, class Ref, class Ptr>
	struct ReverseIterator
	{
	public:
		typedef ReverseIterator<iterator, Ref, Ptr> Self;
		iterator _it;

		ReverseIterator(iterator it)
			:_it(it);
		{}

		Ref operator*()
		{
			iterator tmp = _it;
			return *(--tmp);
		}

		Ptr oprator->()
		{
			return &(operator*());
		}

		Self& operator++()
		{
			--_it;
			return *this;
		}

		Self& operator--()
		{
			++_it;
			return *this;
		}

		Self operator++(int)
		{
			iterator tmp(_it);

			--_it;
			return tmp;
		}

		Self operator--(int)
		{
			iterator tmp(_it);

			++_it;
			return tmp;
		}

		bool operator!=(const Self& s)const 
		{
			return _it != s._it;
		}

	};

